home *** CD-ROM | disk | FTP | other *** search
/ C!T ROM 3 / ct-rom iiib.zip / ct-rom iiib / WINDOWS / DIVERSEN / WINE02BX / EMACS.6 < prev    next >
Text File  |  1993-03-28  |  51KB  |  1,141 lines

  1. Info file ../info/emacs, produced by Makeinfo, -*- Text -*- from input
  2. file lemacs.tex.
  3.  
  4.    This file documents the GNU Emacs editor.
  5.  
  6.    Copyright (C) 1985, 1986, 1988 Richard M. Stallman.  Copyright (C)
  7. 1991, 1992 Lucid, Inc.
  8.  
  9.    Permission is granted to make and distribute verbatim copies of
  10. this manual provided the copyright notice and this permission notice
  11. are preserved on all copies.
  12.  
  13.    Permission is granted to copy and distribute modified versions of
  14. this manual under the conditions for verbatim copying, provided also
  15. that the sections entitled "The GNU Manifesto", "Distribution" and "GNU
  16. General Public License" are included exactly as in the original, and
  17. provided that the entire resulting derived work is distributed under
  18. the terms of a permission notice identical to this one.
  19.  
  20.    Permission is granted to copy and distribute translations of this
  21. manual into another language, under the above conditions for modified
  22. versions, except that the sections entitled "The GNU Manifesto",
  23. "Distribution" and "GNU General Public License" may be included in a
  24. translation approved by the author instead of in the original English.
  25.  
  26. 
  27. File: emacs,  Node: Visiting,  Next: Saving,  Prev: File Names,  Up: Files
  28.  
  29. Visiting Files
  30. ==============
  31.  
  32. `C-x C-f'
  33.      Visit a file (`find-file').
  34.  
  35. `C-x C-v'
  36.      Visit a different file instead of the one visited last
  37.      (`find-alternate-file').
  38.  
  39. `C-x 4 C-f'
  40.      Visit a file, in another window (`find-file-other-window').  Don't
  41.      change this window.
  42.  
  43.    "Visiting" a file means copying its contents into an Emacs buffer
  44. so you can edit it.  Emacs creates a new buffer for each file you
  45. visit.  We say that the buffer is visiting the file that it was created
  46. to hold.  Emacs constructs the buffer name from the file name by
  47. throwing away the directory, keeping just the file name.  For example,
  48. a file named `/usr/rms/emacs.tex' is displayed in a buffer named
  49. `emacs.tex'.  If a buffer with that name exists, a unique name is
  50. constructed by appending `<2>', `<3>',and so on, using the lowest
  51. number that makes a name that is not already in use.
  52.  
  53.    Each window's mode line shows the name of the buffer that is being
  54. displayed in that window, so you can always tell what buffer you are
  55. editing.
  56.  
  57.    The changes you make with Emacs are made in the Emacs buffer.  They
  58. do not take effect in the file that you visit, or any other permanent
  59. place, until you "save" the buffer.  Saving the buffer means that
  60. Emacs writes the current contents of the buffer into its visited file. 
  61. *Note Saving::.
  62.  
  63.    If a buffer contains changes that have not been saved, the buffer
  64. is said to be "modified".  This is important because it implies that
  65. some changes will be lost if the buffer is not saved.  The mode line
  66. displays two stars near the left margin if the buffer is modified.
  67.  
  68.    To visit a file, use the command `C-x C-f' (`find-file').  Follow
  69. the command with the name of the file you wish to visit, terminated by
  70. a RET.  If you are using Lucid GNU Emacs under X, you can also use the
  71. Open File... command from the File menu bar item.
  72.  
  73.    The file name is read using the minibuffer (*note Minibuffer::.),
  74. with defaulting and completion in the standard manner (*note File
  75. Names::.).  While in the minibuffer, you can abort `C-x C-f' by typing
  76. `C-g'.
  77.  
  78.    `C-x C-f' has completed successfully when text appears on the
  79. screen and a new buffer name appears in the mode line.  If the
  80. specified file does not exist and could not be created or cannot be
  81. read, an error results.  The error message is printed in the echo
  82. area, and includes the name of the file that Emacs was trying to visit.
  83.  
  84.    If you visit a file that is already in Emacs, `C-x C-f' does not
  85. make another copy.  It selects the existing buffer containing that
  86. file.  However, before doing so, it checks that the file itself has
  87. not changed since you visited or saved it last.  If the file has
  88. changed, Emacs prints a warning message.  *Note Simultaneous Editing:
  89. Interlocking.
  90.  
  91.    You can switch to a specific file called out in the current buffer
  92. by calling the function `find-this-file'. By providing a prefix
  93. argument, this function calls `filename-at-point' and switches to a
  94. buffer visiting the file FILENAME. It creates one if none already
  95. exists. You can use this function to edit the file mentioned in the
  96. buffer you are working in or to test if the file exists. You can do
  97. that by using the minibuffer completion after snatching the all or
  98. part of the filename.
  99.  
  100.    You can display a file in a new screen by using the function
  101. `find-file-new-screen'. This function is similar to `find-file' except
  102. that it creates a new screen in which the file is displayed.
  103.  
  104.    If the variable `find-file-use-truenames''s value is non-`nil', a
  105. buffer's visited filename will always be traced back to the real file.
  106. The filename will never be a symbolic link, and there will never be a
  107. symbolic link anywhere in its directory path. In other words, the
  108. `buffer-file-name' and `buffer-file-truename' will be equal.
  109.  
  110.    If the variable `find-file-compare-truenames' value is non-`nil',
  111. the `find-file' command will check the `buffer-file-truename' of all
  112. visited files when deciding whether a given file is already in a
  113. buffer, instead of just `buffer-file-name'.  If you attempt to visit
  114. another file which is a hard-link or symbolic-link to a file that is
  115. already in a buffer, the existing buffer will be found instead of a
  116. newly created one.
  117.  
  118.    If you want to create a file, just visit it.  Emacs prints `(New
  119. File)' in the echo area, but in other respects behaves as if you had
  120. visited an existing empty file.  If you make any changes and save them,
  121. the file is created.
  122.  
  123.    If you visit a nonexistent file unintentionally (because you typed
  124. the wrong file name), use the `C-x C-v' (`find-alternate-file')
  125. command to visit the file you wanted.  `C-x C-v' is similar to `C-x
  126. C-f', but it kills the current buffer (after first offering to save it
  127. if it is modified).  `C-x C-v' is allowed even if the current buffer
  128. is not visiting a file.
  129.  
  130.    If the file you specify is actually a directory, Dired is called on
  131. that directory (*note Dired::.).  To inhibit this, set the variable
  132. `find-file-run-dired' to `nil'; then it is an error to try to visit a
  133. directory.
  134.  
  135.    `C-x 4 f' (`find-file-other-window') is like `C-x C-f' except that
  136. the buffer containing the specified file is selected in another
  137. window.  The window that was selected before `C-x 4 f' continues to
  138. show the same buffer it was already showing.  If you use this command
  139. when only one window is being displayed, that window is split in two,
  140. with one window showing the same buffer as before, and the other one
  141. showing the newly requested file.  *Note Windows::.
  142.  
  143.    Use the function `find-this-file-other-window' to edit a file
  144. mentioned in the buffer yuou are editing or to test if that file
  145. exists.  To do do this, use the minibuffer completion after snatching
  146. the part or all of the filename. By providing a prefix argument, the
  147. function calls `filename-at-point' abd switches you to a buffer
  148. visiting the file FILENAME in another window. The function creates a
  149. buffer if none already exists. This function is similar to
  150. `find-file-other-window'.
  151.  
  152.    There are two hook variables that allow extensions to modify the
  153. operation of visiting files.  Visiting a file that does not exist runs
  154. the functions in the list `find-file-not-found-hooks'; the value of
  155. this variable is expected to be a list of functions which are called
  156. one by one until one of them returns non-`nil'.  Any visiting of a
  157. file, whether extant or not, expects `find-file-hooks' to contain list
  158. of functions and calls them all, one by one.  In both cases the
  159. functions receive no arguments.  Visiting a nonexistent file runs the
  160. `find-file-not-found-hooks' first.
  161.  
  162. 
  163. File: emacs,  Node: Saving,  Next: Reverting,  Prev: Visiting,  Up: Files
  164.  
  165. Saving Files
  166. ============
  167.  
  168.    "Saving" a buffer in Emacs means writing its contents back into the
  169. file that was visited in the buffer.
  170.  
  171. `C-x C-s'
  172.      Save the current buffer in its visited file (`save-buffer').
  173.  
  174. `C-x s'
  175.      Save any or all buffers in their visited files
  176.      (`save-some-buffers').
  177.  
  178. `M-~'
  179.      Forget that the current buffer has been changed (`not-modified').
  180.  
  181. `C-x C-w'
  182.      Save the current buffer in a specified file, and record that file
  183.      as the one visited in the buffer (`write-file').
  184.  
  185. `M-x set-visited-file-name'
  186.      Change file the name under which the current buffer will be saved.
  187.  
  188.    To save a file and make your changes permanent, type `C-x C-s'
  189. (`save-buffer').  After saving is finished, `C-x C-s' prints a message
  190. like
  191.  
  192.      Wrote /u/rms/gnu/gnu.tasks
  193.  
  194. If the selected buffer is not modified (no changes have been made in it
  195. since the buffer was created or last saved), Emacs does not save it
  196. because it would have no effect.  Instead, `C-x C-s' prints a message
  197. in the echo area saying
  198.  
  199.      (No changes need to be written)
  200.  
  201.    The command `C-x s' (`save-some-buffers') can save any or all
  202. modified buffers.  First it asks, for each modified buffer, whether to
  203. save it.  The questions should be answered with `y' or `n'.  `C-x
  204. C-c', the key that kills Emacs, invokes `save-some-buffers' and
  205. therefore asks the same questions.
  206.  
  207.    If you have changed a buffer and do not want the changes to be
  208. saved, you should take some action to prevent it.  Otherwise, you are
  209. liable to save it by mistake each time you use `save-some-buffers' or a
  210. related command.  One thing you can do is type `M-~' (`not-modified'),
  211. which removes the indication that the buffer is modified.  If you do
  212. this, none of the save commands will believe that the buffer needs to
  213. be saved.  (`~' is often used as a mathematical symbol for `not'; thus
  214. `Meta-~' is `not', metafied.) You could also use
  215. `set-visited-file-name' (see below) to mark the buffer as visiting a
  216. different file name, not in use for anything important.
  217.  
  218.    You can also undo all the changes made since the file was visited or
  219. saved, by reading the text from the file again.  This is called
  220. "reverting".  *Note Reverting::.  Alternatively, you can undo all the
  221. changes by repeating the undo command `C-x u'; but this only works if
  222. you have not made more changes than the undo mechanism can remember.
  223.  
  224.    `M-x set-visited-file-name' alters the name of the file that the
  225. current buffer is visiting.  It prompts you for the new file name in
  226. the minibuffer.  You can also use `set-visited-file-name' on a buffer
  227. that is not visiting a file.  The buffer's name is changed to
  228. correspond to the file it is now visiting unless the new name is
  229. already used by a different buffer; in that case, the buffer name is
  230. not changed.  `set-visited-file-name' does not save the buffer in the
  231. newly visited file; it just alters the records inside Emacs so that it
  232. will save the buffer in that file.  It also marks the buffer as
  233. "modified" so that `C-x C-s' will save.
  234.  
  235.    If you wish to mark a buffer as visiting a different file and save
  236. it right away, use `C-x C-w' (`write-file').  It is precisely
  237. equivalent to `set-visited-file-name' followed by `C-x C-s'.  `C-x
  238. C-s' used on a buffer that is not visiting  a file has the same effect
  239. as `C-x C-w'; that is, it reads a file name, marks the buffer as
  240. visiting that file, and saves it there.  The default file name in a
  241. buffer that is not visiting a file is made by combining the buffer name
  242. with the buffer's default directory.
  243.  
  244.    If Emacs is about to save a file and sees that the date of the
  245. latest version on disk does not match what Emacs last read or wrote,
  246. Emacs notifies you of this fact, because it probably indicates a
  247. problem caused by simultaneous editing and requires your immediate
  248. attention.  *Note Simultaneous Editing: Interlocking.
  249.  
  250.    If the variable `require-final-newline' is non-`nil', Emacs puts a
  251. newline at the end of any file that doesn't already end in one, every
  252. time a file is saved or written.
  253.  
  254.    Use the hook variable `write-file-hooks' to implement other ways to
  255. write files, and specify things to be done before files are written. 
  256. The value of this variable should be a list of Lisp functions.  When a
  257. file is to be written, the functions in the list are called, one by
  258. one, with no arguments.  If one of them returns a non-`nil' value,
  259. Emacs takes this to mean that the file has been written in some
  260. suitable fashion; the rest of the functions are not called, and normal
  261. writing is not done. Use the hook variable `after-write-file-hooks' to
  262. list all the functions to be called after writing out a buffer to a
  263. file.
  264.  
  265. * Menu:
  266.  
  267. * Backup::       How Emacs saves the old version of your file.
  268. * Interlocking:: How Emacs protects against simultaneous editing
  269.                   of one file by two users.
  270.  
  271. 
  272. File: emacs,  Node: Backup,  Next: Interlocking,  Prev: Saving,  Up: Saving
  273.  
  274. Backup Files
  275. ------------
  276.  
  277.    Because Unix does not provide version numbers in file names,
  278. rewriting a file in Unix automatically destroys all record of what the
  279. file used to contain.  Thus, saving a file from Emacs throws away the
  280. old contents of the file--or it would, except that Emacs carefully
  281. copies the old contents to another file, called the "backup" file,
  282. before actually saving.  (Provided the variable `make-backup-files' is
  283. non-`nil'.  Backup files are not written if this variable is `nil').
  284.  
  285.    At your option, Emacs can keep either a single backup file or a
  286. series of numbered backup files for each file you edit.
  287.  
  288.    Emacs makes a backup for a file only the first time a file is saved
  289. from one buffer.  No matter how many times you save a file, its backup
  290. file continues to contain the contents from before the file was
  291. visited.  Normally this means that the backup file contains the
  292. contents from before the current editing session; however, if you kill
  293. the buffer and then visit the file again, a new backup file is made by
  294. the next save.
  295.  
  296. * Menu:
  297.  
  298. * Names: Backup Names.        How backup files are named;
  299.                 Choosing single or numbered backup files.
  300. * Deletion: Backup Deletion.    Emacs deletes excess numbered backups.
  301. * Copying: Backup Copying.    Backups can be made by copying or renaming.
  302.  
  303. 
  304. File: emacs,  Node: Backup Names,  Next: Backup Deletion,  Prev: Backup,  Up: Backup
  305.  
  306. Single or Numbered Backups
  307. ..........................
  308.  
  309.    If you choose to have a single backup file (the default), the
  310. backup file's name is constructed by appending `~' to the file name
  311. being edited; thus, the backup file for `eval.c' is `eval.c~'.
  312.  
  313.    If you choose to have a series of numbered backup files, backup file
  314. names are made by appending `.~', the number, and another `~' to the
  315. original file name.  Thus, the backup files of `eval.c' would be
  316. called `eval.c.~1~', `eval.c.~2~', and so on, through names like
  317. `eval.c.~259~' and beyond.
  318.  
  319.    If protection stops you from writing backup files under the usual
  320. names, the backup file is written as `%backup%~' in your home
  321. directory.  Only one such file can exist, so only the most recently
  322. made backup is available.
  323.  
  324.    The choice of single backup or numbered backups is controlled by the
  325. variable `version-control'.  Its possible values are
  326.  
  327. `t'
  328.      Make numbered backups.
  329.  
  330. `nil'
  331.      Make numbered backups for files that have numbered backups
  332.      already.  Otherwise, make single backups.
  333.  
  334. `never'
  335.      Never make numbered backups; always make single backups.
  336.  
  337. `version-control' may be set locally in an individual buffer to
  338. control the making of backups for that buffer's file.  For example,
  339. Rmail mode locally sets `version-control' to `never' to make sure that
  340. there is only one backup for an Rmail file.  *Note Locals::.
  341.  
  342. 
  343. File: emacs,  Node: Backup Deletion,  Next: Backup Copying,  Prev: Backup Names,  Up: Backup
  344.  
  345. Automatic Deletion of Backups
  346. .............................
  347.  
  348.    To prevent unlimited consumption of disk space, Emacs can delete
  349. numbered backup versions automatically.  Generally Emacs keeps the
  350. first few backups and the latest few backups, deleting any in between.
  351.  This happens every time a new backup is made.  The two variables that
  352. control the deletion are `kept-old-versions' and `kept-new-versions'. 
  353. Their values are, respectively the number of oldest (lowest-numbered)
  354. backups to keep and the number of newest (highest-numbered) ones to
  355. keep, each time a new backup is made.  The values are used just after
  356. a new backup version is made; that newly made backup is included in
  357. the count in `kept-new-versions'.  By default, both variables are 2.
  358.  
  359.    If `trim-versions-without-asking' is non-`nil',  excess middle
  360. versions are deleted without notification.  If it is `nil', the
  361. default, you are asked whether the excess middle versions should
  362. really be deleted.
  363.  
  364.    You can also use Dired's `.' (Period) command to delete old
  365. versions.  *Note Dired::.
  366.  
  367. 
  368. File: emacs,  Node: Backup Copying,  Prev: Backup Deletion,  Up: Backup
  369.  
  370. Copying vs. Renaming
  371. ....................
  372.  
  373.    You can make backup files by copying the old file or by renaming it. 
  374. This makes a difference when the old file has multiple names.  If you
  375. rename the old file into the backup file, the alternate names become
  376. names for the backup file.  If you copy the old file instead, the
  377. alternate names remain names for the file that you are editing, and
  378. the contents accessed by those names will be the new contents.
  379.  
  380.    How you make a backup file may also affect the file's owner and
  381. group.  If you use copying, they do not change.  If renaming is used,
  382. you become the file's owner, and the file's group becomes the default
  383. (different operating systems have different defaults for the group).
  384.  
  385.    Having the owner change is usually a good idea, because then the
  386. owner always shows who last edited the file.  The owners of the
  387. backups show who produced them.  Occasionally there is a file whose
  388. owner should not change.  Since most files` owner should change, it is
  389. a good idea to use local variable lists to set
  390. `backup-by-copying-when-mismatch' for the special cases where the
  391. owner should change.(*note File Variables::.).
  392.  
  393.    Three variables control the choice of renaming or copying. 
  394. Normally, renaming is done.  If the variable `backup-by-copying' is
  395. non-`nil', copying is used.  Otherwise, if the variable
  396. `backup-by-copying-when-linked' is non-`nil', copying is done for
  397. files that have multiple names, but renaming may still be done when
  398. the file being edited has only one name.  If the variable
  399. `backup-by-copying-when-mismatch' is non-`nil', copying is done if
  400. renaming would cause the file's owner or group to change.
  401.  
  402. 
  403. File: emacs,  Node: Interlocking,  Prev: Backup,  Up: Saving
  404.  
  405. Protection against Simultaneous Editing
  406. ---------------------------------------
  407.  
  408.    Simultaneous editing occurs when two users visit the same file, both
  409. make changes, and both save their changes.  If no one was informed that
  410. this was happening, and you saved first, you would later find that your
  411. changes were lost.  On some systems, Emacs notices immediately when the
  412. second user starts to change a file already being edited, and issues a
  413. warning.  When this is not possible, or if the second user has started
  414. to change the file despite the warning, Emacs checks when the file is
  415. saved, and issues a second warning when a user is about to overwrite a
  416. file containing another user's changes.  If you are the user editing
  417. the file, you can take corrective action at this point and prevent
  418. actual loss of work.
  419.  
  420.    When you make the first modification in an Emacs buffer that is
  421. visiting a file, Emacs records that you have locked the file.  (It
  422. does this by writing another file in a directory reserved for this
  423. purpose.)  The lock is removed when you save the changes.  The idea is
  424. that the file is locked whenever the buffer is modified.  If you begin
  425. to modify the buffer while the visited file is locked by someone else,
  426. this constitutes a collision, and Emacs asks you what to do.  It does
  427. this by calling the Lisp function `ask-user-about-lock', which you can
  428. redefine to customize what it does.  The standard definition of this
  429. function asks you a question and accepts three possible answers:
  430.  
  431. `s'
  432.      Steal the lock.  Whoever was already changing the file loses the
  433.      lock, and you get the lock.
  434.  
  435. `p'
  436.      Proceed.  Go ahead and edit the file despite its being locked by
  437.      someone else.
  438.  
  439. `q'
  440.      Quit.  This causes an error (`file-locked') and the modification
  441.      you were trying to make in the buffer does not actually take
  442.      place.
  443.  
  444.    Note that locking works on the basis of a file name; if a file has
  445. multiple names, Emacs does not realize that the two names are the same
  446. file and cannot prevent two users from editing it simultaneously under
  447. different names.  However, basing locking on names means that Emacs
  448. can interlock the editing of new files that do not really exist until
  449. they are saved.
  450.  
  451.    Some systems are not configured to allow Emacs to make locks.  On
  452. these systems, Emacs cannot detect trouble in advance, but it can still
  453. detect it in time to prevent you from overwriting someone else's
  454. changes.
  455.  
  456.    Every time Emacs saves a buffer, it first checks the
  457. last-modification date of the existing file on disk to see that it has
  458. not changed since the file was last visited or saved.  If the date
  459. does not match, it implies that changes were made in the file in some
  460. other way, and these changes are about to be lost if Emacs actually
  461. does save.  To prevent this, Emacs prints a warning message and asks
  462. for confirmation before saving.  Occasionally you will know why the
  463. file was changed and know that it does not matter; then you can answer
  464. `yes' and proceed.  Otherwise, you should cancel the save with `C-g'
  465. and investigate the situation.
  466.  
  467.    The first thing you should do when notified that simultaneous
  468. editing has already taken place is to list the directory with `C-u C-x
  469. C-d' (*note Directory Listing: ListDir.).  This will show the file's
  470. current author.  You should attempt to contact that person and ask her
  471. not to continue editing.  Often the next step is to save the contents
  472. of your Emacs buffer under a different name, and use `diff' to compare
  473. the two files.
  474.  
  475.    Simultaneous editing checks are also made when you visit a file that
  476. is already visited with `C-x C-f' and when you start to modify a file.
  477.  This is not strictly necessary, but it is useful to find out about
  478. such a problem as early as possible, when corrective action takes less
  479. work.
  480.  
  481.    Another way to protect your file is to set the read, write, and
  482. executable permissions for the file. Use the function
  483. `set-default-file-mode' to set the UNIX `umask' value to the NMASK
  484. argument. The `umask' value is the default protection mode for new
  485. files.
  486.  
  487. 
  488. File: emacs,  Node: Reverting,  Next: Auto Save,  Prev: Saving,  Up: Files
  489.  
  490. Reverting a Buffer
  491. ==================
  492.  
  493.    If you have made extensive changes to a file and then change your
  494. mind about them, you can get rid of all changes by reading in the
  495. previous version of the file.  To do this, use `M-x revert-buffer',
  496. which operates on the current buffer.  Since reverting a buffer can
  497. result in very extensive changes, you must confirm it with `yes'.
  498.  
  499.    If the current buffer has been auto-saved more recently than it has
  500. been saved explicitly, `revert-buffer' offers to read the auto save
  501. file instead of the visited file (*note Auto Save::.).  Emacs asks you
  502. about the auto save file before the request for confirmation of the
  503. `revert-buffer' operation, and demands `y' or `n' as an answer.  If
  504. you have started to type `yes' for confirmation without realizing that
  505. the auto-save question was going to be asked, the `y' will answer that
  506. question, but the `es' will not be valid confirmation.  This gives you
  507. a chance to cancel the operation with `C-g' and try again with the
  508. answers you really intend.
  509.  
  510.    `revert-buffer' keeps point at the same distance (measured in
  511. characters) from the beginning of the file.  If the file was edited
  512. only slightly, you will be at approximately the same piece of text
  513. after reverting as before.  If you have made more extensive changes,
  514. the value of point in the old file may bring you to a totally
  515. different piece of text than your last editing point.
  516.  
  517.    A buffer reverted from its visited file is marked "not modified"
  518. until you make a change.
  519.  
  520.    Some kinds of buffers whose contents reflect data bases other than
  521. files, such as Dired buffers, can also be reverted.  For them,
  522. reverting means recalculating their contents from the appropriate
  523. data.  Buffers created randomly with `C-x b' cannot be reverted;
  524. `revert-buffer' reports an error when asked to do so.
  525.  
  526. 
  527. File: emacs,  Node: Auto Save,  Next: ListDir,  Prev: Reverting,  Up: Files
  528.  
  529. Auto-Saving: Protection Against Disasters
  530. =========================================
  531.  
  532.    Emacs saves all the visited files from time to time (based on
  533. counting your keystrokes) without being asked.  This is called
  534. "auto-saving".  It prevents you from losing more than a limited amount
  535. of work if the system crashes.
  536.  
  537.    When Emacs determines it is time for auto-saving, each buffer is
  538. considered, and is auto-saved if auto-saving is turned on for it and
  539. it has changed since the last time it was auto-saved.  If any
  540. auto-saving is done, the message `Auto-saving...' is displayed in the
  541. echo area until auto-saving is finished.  Errors occurring during
  542. auto-saving are caught so that they do not interfere with the
  543. execution of commands you have been typing.
  544.  
  545. * Menu:
  546.  
  547. * Files: Auto Save Files.
  548. * Control: Auto Save Control.
  549. * Recover::        Recovering text from auto-save files.
  550.  
  551. 
  552. File: emacs,  Node: Auto Save Files,  Next: Auto Save Control,  Prev: Auto Save,  Up: Auto Save
  553.  
  554. Auto-Save Files
  555. ---------------
  556.  
  557.    Auto-saving does not normally write to the files you visited,
  558. because it can be undesirable to save a program that is in an
  559. inconsistent state when you have made only half of a planned change. 
  560. Instead, auto-saving is done in a different file called the "auto-save
  561. file", and the visited file is changed only when you save explicitly,
  562. for example, with `C-x C-s'.
  563.  
  564.    Normally, the name of the auto-save file is generated by appending
  565. `#' to the front and back of the visited file name.  Thus, a buffer
  566. visiting file `foo.c' would be auto-saved in a file `#foo.c#'.  Most
  567. buffers that are not visiting files are auto-saved only if you request
  568. it explicitly; when they are auto-saved, the auto-save file name is
  569. generated by appending `#%' to the front and `#' to the back of buffer
  570. name.  For example, the `*mail*' buffer in which you compose messages
  571. to be sent is auto-saved in a file named `#%*mail*#'.  Names of
  572. auto-save files are generated this way unless you customize the
  573. functions `make-auto-save-file-name' and `auto-save-file-name-p' to do
  574. something different.  The file name to be used for auto-saving a
  575. buffer is calculated at the time auto-saving is turned on in that
  576. buffer.
  577.  
  578.    If you want auto-saving to be done in the visited file, set the
  579. variable `auto-save-visited-file-name' to be non-`nil'.  In this mode,
  580. there is really no difference between auto-saving and explicit saving.
  581.  
  582.    Emacs deletes a buffer's auto-save file when you explicitly save the
  583. buffer.  To inhibit the deletion, set the variable
  584. `delete-auto-save-files' to `nil'.  Changing the visited file name
  585. with `C-x C-w' or `set-visited-file-name' renames any auto-save file
  586. to correspond to the new visited name.
  587.  
  588. 
  589. File: emacs,  Node: Auto Save Control,  Next: Recover,  Prev: Auto Save Files,  Up: Auto Save
  590.  
  591. Controlling Auto-Saving
  592. -----------------------
  593.  
  594.    Each time you visit a file, auto-saving is turned on for that file's
  595. buffer if the variable `auto-save-default' is non-`nil' (but not in
  596. batch mode; *note Entering Emacs::.).  The default for this variable
  597. is `t', so Emacs auto-saves buffers that visit files by default.  You
  598. can use the command `M-x auto-save-mode' to turn auto-saving for a
  599. buffer on or off.  Like other minor mode commands, `M-x
  600. auto-save-mode' turns auto-saving on with a positive argument, off
  601. with a zero or negative argument; with no argument, it toggles.
  602.  
  603.    Emacs performs auto-saving periodically based on counting how many
  604. characters you have typed since the last time auto-saving happened. 
  605. The variable `auto-save-interval' specifies the number of characters
  606. between auto-saves.  By default, it is 300.  Emacs also auto-saves
  607. whenever you call the function `do-auto-save'.
  608.  
  609.    Emacs also does auto-saving whenever it gets a fatal error.  This
  610. includes killing the Emacs job with a shell command such as `kill
  611. -emacs', or disconnecting a phone line or network connection.
  612.  
  613.    You can set the number of seconds of idle time before an auto-save
  614. is done.  A value of zero or `nil' means disable auto-saving due to
  615. idleness.
  616.  
  617.    The actual amount of idle time between auto-saves is logarithmically
  618. related to the size of the current buffer.  This variable is the number
  619. of seconds after which an auto-save will happen when the current buffer
  620. is 50k or less; the timeout will be 2 1/4 times this in a 200k buffer,
  621. 3 3/4 times this in a 1000k buffer, and 4 1/2 times this in a 2000k
  622. buffer.
  623.  
  624.    For this variable to have any effect, you must do `(require
  625. 'timer)'.
  626.  
  627. 
  628. File: emacs,  Node: Recover,  Prev: Auto Save Control,  Up: Auto Save
  629.  
  630. Recovering Data from Auto-Saves
  631. -------------------------------
  632.  
  633.    If you want to use the contents of an auto-save file to recover
  634. from a loss of data, use the command `M-x recover-file RET FILE RET'. 
  635. Emacs visits FILE and then (after your confirmation) restores the
  636. contents from the auto-save file `#FILE#'.  You can then save the file
  637. with `C-x C-s' to put the recovered text into FILE itself.  For
  638. example, to recover file `foo.c' from its auto-save file `#foo.c#', do:
  639.  
  640.      M-x recover-file RET foo.c RET
  641.      C-x C-s
  642.  
  643.    Before asking for confirmation, `M-x recover-file' displays a
  644. directory listing describing the specified file and the auto-save file,
  645. so you can compare their sizes and dates.  If the auto-save file is
  646. older, `M-x recover-file' does not offer to read it.
  647.  
  648.    Auto-saving is disabled by `M-x recover-file' because using this
  649. command implies that the auto-save file contains valuable data from a
  650. past session.  If you save the data in the visited file and then go on
  651. to make new changes, turn auto-saving back on with `M-x
  652. auto-save-mode'.
  653.  
  654. 
  655. File: emacs,  Node: ListDir,  Next: Dired,  Prev: Auto Save,  Up: Files
  656.  
  657. Listing a File Directory
  658. ========================
  659.  
  660.    Files are classified by Unix into "directories".  A "directory
  661. listing" is a list of all the files in a directory.  Emacs provides
  662. directory listings in brief format (file names only) and verbose format
  663. (sizes, dates, and authors included).
  664.  
  665. `C-x C-d DIR-OR-PATTERN'
  666.      Print a brief directory listing (`list-directory').
  667.  
  668. `C-u C-x C-d DIR-OR-PATTERN'
  669.      Print a verbose directory listing.
  670.  
  671.    To print a directory listing, use `C-x C-d' (`list-directory'). 
  672. This command prompts in the minibuffer for a file name which is either
  673. a  directory to be listed or pattern containing wildcards for the
  674. files to be listed.  For example,
  675.  
  676.      C-x C-d /u2/emacs/etc RET
  677.  
  678. lists all the files in directory `/u2/emacs/etc'.  An example of
  679. specifying a file name pattern is
  680.  
  681.      C-x C-d /u2/emacs/src/*.c RET
  682.  
  683.    Normally, `C-x C-d' prints a brief directory listing containing just
  684. file names.  A numeric argument (regardless of value) tells it to
  685. print a verbose listing (like `ls -l').
  686.  
  687.    Emacs obtains the text of a directory listing by running `ls' in an
  688. inferior process.  Two Emacs variables control the switches passed to
  689. `ls': `list-directory-brief-switches' is a string giving the switches
  690. to use in brief listings (`"-CF"' by default). 
  691. `list-directory-verbose-switches' is a string giving the switches to
  692. use in a verbose listing (`"-l"' by default).
  693.  
  694.    The variable `diretory-abbrev-alist' is an alist of abbreviations
  695. for file directories.  The list consists of elements of the form
  696. `(FROM .  TO)', each meaning to replace `FROM' with `TO' when it
  697. appears in a directory name.  This replacement is done when setting up
  698. the default directory of a newly visited file.  Every `FROM' string
  699. should start with ``^''.
  700.  
  701.    Use this feature when you have directories which you normally refer
  702. to via absolute symbolic links.  Make `TO' the name of the link, and
  703. `FROM' the name it is linked to.
  704.  
  705. 
  706. File: emacs,  Node: Dired,  Next: Misc File Ops,  Prev: ListDir,  Up: Files
  707.  
  708. Dired, the Directory Editor
  709. ===========================
  710.  
  711.    Dired makes it easy to delete or visit many of the files in a single
  712. directory at once.  It makes an Emacs buffer containing a listing of
  713. the directory.  You can use the normal Emacs commands to move around
  714. in this buffer, and special Dired commands to operate on the files.
  715.  
  716. * Menu:
  717.  
  718. * Enter: Dired Enter.         How to invoke Dired.
  719. * Edit: Dired Edit.           Editing the Dired buffer.
  720. * Deletion: Dired Deletion.   Deleting files with Dired.
  721. * Immed: Dired Immed.         Other file operations through Dired.
  722.  
  723. 
  724. File: emacs,  Node: Dired Enter,  Next: Dired Edit,  Prev: Dired,  Up: Dired
  725.  
  726. Entering Dired
  727. --------------
  728.  
  729.    To invoke dired, type `C-x d' or `M-x dired'.  The command reads a
  730. directory name or wildcard file name pattern as a minibuffer argument
  731. just like the `list-directory' command, `C-x C-d'.  Where `dired'
  732. differs from `list-directory' is in naming the buffer after the
  733. directory name or the wildcard pattern used for the listing, and
  734. putting the buffer into Dired mode so that the special commands of
  735. Dired are available in it.  The variable `dired-listing-switches' is a
  736. string used as an argument to `ls' in making the directory; this string
  737. must contain `-l'.
  738.  
  739.    To display the Dired buffer in another window rather than in the
  740. selected window, use `C-x 4 d' (`dired-other-window)' instead of `C-x
  741. d'.
  742.  
  743. 
  744. File: emacs,  Node: Dired Edit,  Next: Dired Deletion,  Prev: Dired Enter,  Up: Dired
  745.  
  746. Editing in Dired
  747. ----------------
  748.  
  749.    Once the Dired buffer exists, you can switch freely between it and
  750. other Emacs buffers.  Whenever the Dired buffer is selected, certain
  751. special commands are provided that operate on files that are listed. 
  752. The Dired buffer is "read-only", and inserting text in it is not
  753. useful, so ordinary printing characters such as `d' and `x' are used
  754. for Dired commands.  Most Dired commands operate on the file described
  755. by the line that point is on.  Some commands perform operations
  756. immediately; others "flag" the file to be operated on later.
  757.  
  758.    Most Dired commands that operate on the current line's file also
  759. treat a numeric argument as a repeat count, meaning to act on the
  760. files of the next few lines.  A negative argument means to operate on
  761. the files of the preceding lines, and leave point on the first of
  762. those lines.
  763.  
  764.    All the usual Emacs cursor motion commands are available in Dired
  765. buffers.  Some special purpose commands are also provided.  The keys
  766. `C-n' and `C-p' are redefined so that they try to position the cursor
  767. at the beginning of the filename on the line, rather than at the
  768. beginning of the line.
  769.  
  770.    For extra convenience, SPC and `n' in Dired are equivalent to
  771. `C-n'.  `p' is equivalent to `C-p'.  Moving by lines is done so often
  772. in Dired that it deserves to be easy to type.  DEL (move up and
  773. unflag) is often useful simply for moving up.
  774.  
  775.    The `g' command in Dired runs `revert-buffer' to reinitialize the
  776. buffer from the actual disk directory and show any changes made in the
  777. directory by programs other than Dired.  All deletion flags in the
  778. Dired buffer are lost when this is done.
  779.  
  780. 
  781. File: emacs,  Node: Dired Deletion,  Next: Dired Immed,  Prev: Dired Edit,  Up: Dired
  782.  
  783. Deleting Files with Dired
  784. -------------------------
  785.  
  786.    The primary use of Dired is to flag files for deletion and then
  787. delete them.
  788.  
  789. `d'
  790.      Flag this file for deletion.
  791.  
  792. `u'
  793.      Remove deletion-flag on this line.
  794.  
  795. `DEL'
  796.      Remove deletion-flag on previous line, moving point to that line.
  797.  
  798. `x'
  799.      Delete the files that are flagged for deletion.
  800.  
  801. `#'
  802.      Flag all auto-save files (files whose names start and end with
  803.      `#') for deletion (*note Auto Save::.).
  804.  
  805. `~'
  806.      Flag all backup files (files whose names end with `~') for
  807.      deletion (*note Backup::.).
  808.  
  809. `. (Period)'
  810.      Flag excess numeric backup files for deletion.  The oldest and
  811.      newest few backup files of any one file are exempt; the middle
  812.      ones are flagged.
  813.  
  814.    You can flag a file for deletion by moving to the line describing
  815. the file and typing `d' or `C-d'.  The deletion flag is visible as a
  816. `D' at the beginning of the line.  Point is moved to the beginning of
  817. the next line, so that repeated `d' commands flag successive files.
  818.  
  819.    The files are flagged for deletion rather than deleted immediately
  820. to avoid the danger of deleting a file accidentally.  Until you direct
  821. Dired to delete the flagged files, you can remove deletion flags using
  822. the commands `u' and DEL.  `u' works just like `d', but removes flags
  823. rather than making flags.  DEL moves upward, removing flags; it is
  824. like `u' with numeric argument automatically negated.
  825.  
  826.    To delete the flagged files, type `x'.  This command first displays
  827. a list of all the file names flagged for deletion, and requests
  828. confirmation with `yes'.  Once you confirm, all the flagged files are
  829. deleted, and their lines are deleted from the text of the Dired
  830. buffer.  The shortened Dired buffer remains selected.  If you answer
  831. `no' or quit with `C-g', you return immediately to Dired, with the
  832. deletion flags still present and no files actually deleted.
  833.  
  834.    The `#', `~' and `.' commands flag many files for deletion, based
  835. on their names.  These commands are useful precisely because they do
  836. not actually delete any files; you can remove the deletion flags from
  837. any flagged files that you really wish to keep.
  838.  
  839.    `#' flags for deletion all files that appear to have been made by
  840. auto-saving (that is, files whose names begin and end with `#').  `~'
  841. flags for deletion all files that appear to have been made as backups
  842. for files that were edited (that is, files whose names end with `~').
  843.  
  844.    `.' (Period) flags just some of the backup files for deletion: only
  845. numeric backups that are not among the oldest few nor the newest few
  846. backups of any one file.  Normally `dired-kept-versions' (not
  847. `kept-new-versions'; that applies only when saving) specifies the
  848. number of newest versions of each file to keep, and
  849. `kept-old-versions' specifies the number of oldest versions to keep. 
  850. Period with a positive numeric argument, as in `C-u 3 .', specifies the
  851. number of newest versions to keep, overriding `dired-kept-versions'. 
  852. A negative numeric argument overrides `kept-old-versions', using minus
  853. the value of the argument to specify the number of oldest versions of
  854. each file to keep.
  855.  
  856. 
  857. File: emacs,  Node: Dired Immed,  Prev: Dired Deletion,  Up: Dired
  858.  
  859. Immediate File Operations in Dired
  860. ----------------------------------
  861.  
  862.    Some file operations in Dired take place immediately when they are
  863. requested.
  864.  
  865. `c'
  866.      Copies the file described on the current line.  You must supply a
  867.      file name to copy to, using the minibuffer.
  868.  
  869. `f'
  870.      Visits the file described on the current line.  It is just like
  871.      typing `C-x C-f' and supplying that file name.  If the file on
  872.      this line is a subdirectory, `f' actually causes Dired to be
  873.      invoked on that subdirectory.  *Note Visiting::.
  874.  
  875. `o'
  876.      Like `f', but uses another window to display the file's buffer. 
  877.      The Dired buffer remains visible in the first window.  This is
  878.      like using `C-x 4 C-f' to visit the file.  *Note Windows::.
  879.  
  880. `r'
  881.      Renames the file described on the current line.  You must supply
  882.      a file name to rename to, using the minibuffer.
  883.  
  884. `v'
  885.      Views the file described on this line using `M-x view-file'. 
  886.      Viewing a file is like visiting it, but is slanted toward moving
  887.      around in the file conveniently and does not allow changing the
  888.      file.  *Note View File: Misc File Ops.  Viewing a file that is a
  889.      directory runs Dired on that directory.
  890.  
  891. 
  892. File: emacs,  Node: Misc File Ops,  Prev: Dired,  Up: Files
  893.  
  894. Miscellaneous File Operations
  895. =============================
  896.  
  897.    Emacs has commands for performing many other operations on files. 
  898. All operate on one file; they do not accept wildcard file names.
  899.  
  900.    You can use the command `M-x add-name-to-file' to add a name to an
  901. existing file without removing the old name.  The new name must belong
  902. on the file system that the file is on.
  903.  
  904.    `M-x append-to-file' adds the text of the region to the end of the
  905. specified file.
  906.  
  907.    `M-x copy-file' reads the file OLD and writes a new file named NEW
  908. with the same contents.  Confirmation is required if a file named NEW
  909. already exists, because copying overwrites the old contents of the
  910. file NEW.
  911.  
  912.    `M-x delete-file' deletes a specified file, like the `rm' command
  913. in the shell.  If you are deleting many files in one directory, it may
  914. be more convenient to use Dired (*note Dired::.).
  915.  
  916.    `M-x insert-file' inserts a copy of the contents of a specified
  917. file into the current buffer at point, leaving point unchanged before
  918. the contents and the mark after them.  *Note Mark::.
  919.  
  920.    `M-x make-symbolic-link' reads two file names OLD and LINKNAME, and
  921. then creates a symbolic link named LINKNAME and pointing at OLD.  The
  922. future attempts to open file LINKNAME will then refer to the file
  923. named OLD at the time the opening is done, or will result in an error
  924. if the name OLD is not in use at that time.  Confirmation is required
  925. if you create the link while LINKNAME is in use.  Note that not all
  926. systems support symbolic links.
  927.  
  928.    `M-x rename-file' reads two file names OLD and NEW using the
  929. minibuffer, then renames file OLD as NEW.  If a file named NEW already
  930. exists, you must confirm with `yes' or renaming is not done; this is
  931. because renaming causes the old meaning of the name NEW to be lost. 
  932. If OLD and NEW are on different file systems, the file OLD is copied
  933. and deleted.
  934.  
  935.    `M-x view-file' allows you to scan or read a file by sequential
  936. screenfuls.  It reads a file name argument using the minibuffer.  After
  937. reading the file into an Emacs buffer, `view-file' reads and displays
  938. one windowful.  You can then type SPC to scroll forward one window, or
  939. DEL to scroll backward.  Various other commands are provided for
  940. moving around in the file, but none for changing it; type `C-h' while
  941. viewing a file for a list of them.  Most commands are the default Emacs
  942. cursor motion commands.  To exit from viewing, type `C-c'.
  943.  
  944. 
  945. File: emacs,  Node: Buffers,  Next: Windows,  Prev: Files,  Up: Top
  946.  
  947. Using Multiple Buffers
  948. **********************
  949.  
  950.    Text you are editing in Emacs resides in an object called a
  951. "buffer".  Each time you visit a file, Emacs creates a buffer to hold
  952. the file's text.  Each time you invoke Dired, Emacs creates a buffer
  953. to hold the directory listing.  If you send a message with `C-x m', a
  954. buffer named `*mail*' is used to hold the text of the message.  When
  955. you ask for a command's documentation, it appears in a buffer called
  956. `*Help*'.
  957.  
  958.    At any time, one and only one buffer is "selected".  It is also
  959. called the "current buffer".  Saying a command operates on "the
  960. buffer" really means that the command operates on the selected buffer,
  961. as most commands do.
  962.  
  963.    When Emacs creates multiple windows, each window has a chosen
  964. buffer which is displayed there, but at any time only one of the
  965. windows is selected and its chosen buffer is the selected buffer. 
  966. Each window's mode line displays the name of the buffer the window is
  967. displaying (*note Windows::.).
  968.  
  969.    Each buffer has a name which can be of any length but is
  970. case-sensitive.  You can select a buffer using its name.  Most buffers
  971. are created when you visit files; their names are derived from the
  972. files' names.  You can also create an empty buffer with any name you
  973. want.  A newly started Emacs has a buffer named `*scratch*' which you
  974. can use for evaluating Lisp expressions in Emacs.
  975.  
  976.    Each buffer records what file it is visiting, whether it is
  977. modified, and what major mode and minor modes are in effect in it
  978. (*note Major Modes::.).  Any Emacs variable can be made "local to" a
  979. particular buffer, meaning its value in that buffer can be different
  980. from the value in other buffers.  *Note Locals::.
  981.  
  982. * Menu:
  983.  
  984. * Select Buffer::   Creating a new buffer or reselecting an old one.
  985. * List Buffers::    Getting a list of buffers that exist.
  986. * Misc Buffer::     Renaming; changing read-onliness; copying text.
  987. * Kill Buffer::     Killing buffers you no longer need.
  988. * Several Buffers:: How to go through the list of all buffers
  989.                      and operate variously on several of them.
  990.  
  991. 
  992. File: emacs,  Node: Select Buffer,  Next: List Buffers,  Prev: Buffers,  Up: Buffers
  993.  
  994. Creating and Selecting Buffers
  995. ==============================
  996.  
  997. `C-x b BUFFER RET'
  998.      Select or create a buffer named BUFFER (`switch-to-buffer').
  999.  
  1000. `C-x 4 b BUFFER RET'
  1001.      Similar but select a buffer named BUFFER in another window
  1002.      (`switch-to-buffer-other-window').
  1003.  
  1004. `M-x switch-to-other-buffer N'
  1005.      Switch to the previous buffer.
  1006.  
  1007.    To select a buffer named BUFNAME, type `C-x b BUFNAME RET'.  This
  1008. is the command `switch-to-buffer' with argument BUFNAME.  You can use
  1009. completion on an abbreviation for the buffer name you want (*note
  1010. Completion::.).  An empty argument to `C-x b' specifies the most
  1011. recently selected buffer that is not displayed in any window.
  1012.  
  1013.    Most buffers are created when you visit files, or use Emacs commands
  1014. that display text.  You can also create a buffer explicitly by typing
  1015. `C-x b BUFNAME RET', which creates a new, empty buffer that is not
  1016. visiting any file, and selects it for editing.  The new buffer's major
  1017. mode is determined by the value of `default-major-mode' (*note Major
  1018. Modes::.).  Buffers not visiting files are usually used for making
  1019. notes to yourself.  If you try to save one, you are asked for the file
  1020. name to use.
  1021.  
  1022.    The function `switch-to-bufer-new-screen' is similar to
  1023. `switch-to-buffer' except that it creates a new screen in which to
  1024. display the selected buffer.
  1025.  
  1026.    Use `M-x switch-to-other-buffer' to visit the previous buffer. If
  1027. you supply a positive integer N, the Nth most recent buffer is
  1028. displayed. If you supply an argument of 0, the current buffer is moved
  1029. to the bottom of the buffer stack.
  1030.  
  1031.    Note that you can also use `C-x C-f' and any other command for
  1032. visiting a file to switch buffers.  *Note Visiting::.
  1033.  
  1034. 
  1035. File: emacs,  Node: List Buffers,  Next: Misc Buffer,  Prev: Select Buffer,  Up: Buffers
  1036.  
  1037. Listing Existing Buffers
  1038. ========================
  1039.  
  1040. `C-x C-b'
  1041.      List the existing buffers (`list-buffers').
  1042.  
  1043.    To print a list of all existing buffers, type `C-x C-b'.  Each line
  1044. in the list shows one buffer's name, major mode and visited file.  `*'
  1045. at the beginning of a line indicates the buffer has been "modified". 
  1046. If several buffers are modified, it may be time to save some with `C-x
  1047. s' (*note Saving::.).  `%' indicates a read-only buffer.  `.' marks
  1048. the selected buffer.  Here is an example of a buffer list:
  1049.  
  1050.       MR Buffer         Size  Mode           File
  1051.       -- ------         ----  ----           ----
  1052.      .*  emacs.tex      383402 Texinfo       /u2/emacs/man/emacs.tex
  1053.          *Help*         1287  Fundamental
  1054.          files.el       23076 Emacs-Lisp     /u2/emacs/lisp/files.el
  1055.        % RMAIL          64042 RMAIL          /u/rms/RMAIL
  1056.       *% man            747   Dired        /u2/emacs/man/
  1057.          net.emacs      343885 Fundamental   /u/rms/net.emacs
  1058.          fileio.c       27691 C              /u2/emacs/src/fileio.c
  1059.          NEWS           67340 Text           /u2/emacs/etc/NEWS
  1060.          *scratch*       0     Lisp Interaction
  1061.  
  1062. Note that the buffer `*Help*' was made by a help request; it is not
  1063. visiting any file.  The buffer `man' was made by Dired on the
  1064. directory `/u2/emacs/man/'.
  1065.  
  1066.    As you move the mouse over the `*Buffer List*' buffer, the lines
  1067. are highlighted.  This visual cue indicates that clicking the right
  1068. mouse button (`button3') will pop up a menu of commands on the buffer
  1069. represented by this line.  This menu duplicates most of those commands
  1070. which are bound to keys in the `*Buffer List*' buffer.
  1071.  
  1072. 
  1073. File: emacs,  Node: Misc Buffer,  Next: Kill Buffer,  Prev: List Buffers,  Up: Buffers
  1074.  
  1075. Miscellaneous Buffer Operations
  1076. ===============================
  1077.  
  1078. `C-x C-q'
  1079.      Toggle read-only status of buffer (`toggle-read-only').
  1080.  
  1081. `M-x rename-buffer'
  1082.      Change the name of the current buffer.
  1083.  
  1084. `M-x view-buffer'
  1085.      Scroll through a buffer.
  1086.  
  1087.    A buffer can be "read-only", which means that commands to change
  1088. its text are not allowed.  Normally, read-only buffers are created by
  1089. subsystems such as Dired and Rmail that have special commands to
  1090. operate on the text.  Emacs also creates a read-only buffer if you
  1091. visit a file that is protected.  To make changes in a read-only buffer,
  1092. use the command `C-x C-q' (`toggle-read-only').  It makes a read-only
  1093. buffer writable, and makes a writable buffer read-only.  This works by
  1094. setting the variable `buffer-read-only', which has a local value in
  1095. each buffer and makes a buffer read-only if its value is non-`nil'.
  1096.  
  1097.    `M-x rename-buffer' changes the name of the current buffer,
  1098. prompting for the new name in the minibuffer.  There is no default. 
  1099. If you specify a name that is used by a different buffer, an error is
  1100. signalled and renaming is not done.
  1101.  
  1102.    `M-x view-buffer' is similar to `M-x view-file' (*note Misc File
  1103. Ops::.) but examines an already existing Emacs buffer.  View mode
  1104. provides commands for scrolling through the buffer conveniently but not
  1105. for changing it.  When you exit View mode, the resulting value of point
  1106. remains in effect.
  1107.  
  1108.    To copy text from one buffer to another, use the commands `C-x a'
  1109. (`append-to-buffer') and `M-x insert-buffer'.  *Note Accumulating
  1110. Text::.
  1111.  
  1112. 
  1113. File: emacs,  Node: Kill Buffer,  Next: Several Buffers,  Prev: Misc Buffer,  Up: Buffers
  1114.  
  1115. Killing Buffers
  1116. ===============
  1117.  
  1118.    After using Emacs for a while, you may accumulate a large number of
  1119. buffers, and may want to eliminate the ones you no longer need.  There
  1120. are several commands for doing this.
  1121.  
  1122. `C-x k'
  1123.      Kill a buffer, specified by name (`kill-buffer').
  1124.  
  1125. `M-x kill-some-buffers'
  1126.      Offer to kill each buffer, one by one.
  1127.  
  1128.    `C-x k' (`kill-buffer') kills one buffer, whose name you specify in
  1129. the minibuffer.  If you type just RET in the minibuffer, the default,
  1130. killing the current buffer, is used.  If the current buffer is killed,
  1131. the buffer that has been selected recently but does not appear in any
  1132. window now is selected.  If the buffer being killed contains unsaved
  1133. changes you are asked to confirm with `yes' before the buffer is
  1134. killed.
  1135.  
  1136.    The command `M-x kill-some-buffers' asks about each buffer, one by
  1137. one.  An answer of `y' means to kill the buffer.  Killing the current
  1138. buffer or a buffer containing unsaved changes selects a new buffer or
  1139. asks for confirmation just like `kill-buffer'.
  1140.  
  1141.